package org.liip.clickhouse.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.liip.clickhouse.entity.User;

import java.util.List;

@Mapper
public interface UserMapper {

    List<User> queryUser();

    Integer insertUser(User user);
    
    @Insert({
    	 "<script>",
    	 "INSERT INTO `default`.`user` (`userId`, `appId`, `version`, `regTime`) VALUES ",
    	 "<foreach collection='userLists' item='item' index='index' separator=','>",
    	 "(#{item.userId}, #{item.appId}, #{item.version}, #{item.regTime})",
    	 "</foreach>",
    	 "</script>"
    	})
    Integer insertCollectList(@Param(value="userLists") List<User> userLists);

}
